---
title: "Analysis Script"
author: "Martin Naunov"
date: "01/03/2023"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning=FALSE,message=FALSE)
setwd("/Users/martinnaunov/Desktop/Desktop - Martin’s MacBook Pro (2)/Persuasion/2_workingdata")
```

```{r, include=FALSE}
library(dplyr)
library(data.table) 
library(modelsummary)
library(gridExtra)
library(ggplot2)
library(grid)
library(lme4)
library(lmerTest)
library(stargazer) 
library(marginaleffects)
library(psych)
rm(list=ls())
```


```{r}
setwd("/Users/martinnaunov/Desktop/Desktop - Martin’s MacBook Pro (2)/Persuasion/2_workingdata")
library(dplyr)
### Read in senders' data 
df <- read.csv("senders_working2_v3.csv") %>% 
  dplyr::select(edu, female, income, age, race, pol_intr,
         pol_intr_full, pol_know_avg, persp_tak, nfc, mlengthwords, mlengthchar, 
         time, env_att_strength, imm_att_strength, trans_att_strength, write_yes, 
         side, StartDate, EndDate, Finished, partyid_7, writing_task, respid, 
         personal_rev, specific_fact, common_ground) %>% 
  mutate_at(vars(edu, income, age, pol_intr, pol_intr_full, pol_know_avg, persp_tak, nfc, 
                 mlengthwords, mlengthchar, time, partyid_7), .funs = as.numeric) %>% 
  mutate_at(vars(female, race, env_att_strength, imm_att_strength, trans_att_strength, 
                 side, Finished,personal_rev, specific_fact, common_ground ), .funs = as.factor)

setwd("/Users/martinnaunov/Desktop/Desktop - Martin’s MacBook Pro (2)/Persuasion/2_workingdata")

df2 <- read.csv("working_data_final_sr1_v2.csv")


df2 <- read.csv("working_data_final_sr1_v2.csv") %>% 
  dplyr::select(pre, post, side, quarkelt1, quarkelt2, respid, respondent,
                partyid_7, issue, affpol, att_strength, pol_intr_full, pol_intr, 
                pol_know_avg, persp_tak, nfc, self_est, female, race, edu, 
                income, age, mlengthwords, mlengthchar, time, common_ground, 
                personal_rev, specific_fact, respondent, 
                task_persuade, task_expect, movement, binary) %>% 
  mutate_at(vars(pre, post, quarkelt1, quarkelt2, partyid_7, affpol, 
                 att_strength, pol_intr_full, pol_intr, pol_know_avg, 
                 persp_tak, nfc,  self_est, income, age, mlengthwords, 
                 mlengthchar, time, task_persuade),
            .funs = as.numeric) %>% 
  mutate_at(vars(side, respid, respondent, 
                 issue, female, race, edu, common_ground,
                 personal_rev, specific_fact, task_expect, movement, binary), .funs = as.factor)
  

```


## Number of individuals who reported neutral opinions on all three issues. Five 
## Inviduals express neutral opinions on all three issues. 
```{r}
df %>% 
  filter(env_att_strength == 0 & imm_att_strength == 0 & trans_att_strength == 0) %>% 
  nrow(.)
```


#Alternatively, we can consider those who either have all neutral opinions, 
#neutral opinions with some nonresponses, or all nonresponses. This is captured 
#by the variable side. This applies to 20 individuals. 
```{r}
sum(is.na(df$personal_rev))

sum(is.na(df$side))
```
## Compare participants who completed the writing task to those who didn't.
#Here it makes sense to separate out those who were not invited to complete the 
#writing task (the 20 individuals above) (1), from those who were invited to complete 
#the writing task but didn't (2), and those who were invited to complete the task and did(3). 
```{r}
# Make a new variable called compare_s
df$compare_s[df$write_yes == T] <- 1
df$compare_s[df$write_yes == F] <- 2
df$compare_s[is.na(df$side == T)] <- NA
df$compare_s[df$env_att_strength == 0 & 
               df$imm_att_strength == 0 & 
               df$trans_att_strength == 0] <- 3

df$compare_s <- as.factor(df$compare_s)

# See how many obs fall into each category
table(df$compare_s, useNA = "always")


# Compare the groups on age, partisanship, education, interest in politics, 
# and their N's 
df %>% 
  group_by(compare_s) %>% 
  summarise_at(vars(age, partyid_7, edu, pol_intr_full),
               list(mean = mean), na.rm = T)
```


## Arguments that People Chose to Skip
# Footnote 10: 61 Receivers opted to skip the Renewable energy issue, 77 opted to skip the Immigration issue, and 118 opted to skip the Transgender issue in Study 1.
Below are the arguments that people chose to skip. (1) is environmental policy, 
(2) is immigration, and (3) is transgender rights
```{r}
setwd("/Users/martinnaunov/Desktop/Desktop - Martin’s MacBook Pro (2)/Persuasion/2_workingdata")

receivers <- read.csv("receivers_1_working_wide_v2.csv")

table(receivers$skip)

# Renewable Energy
15  +  10 +   30  +   6 

# Immigration
10   + 30  + 13 +   24

# Transgender
30 + 6 + 24 +   58 
```

## Arguments Excluded
# Code to Replicate Table 1: Arguments collected, by type
## "Collecting and vetting arguments" sub-section in main text
```{r}

setwd("/Users/martinnaunov/Desktop/Desktop - Martin’s MacBook Pro (2)/Persuasion/2_workingdata")
library(readxl)
### arg_check
arg_check <- read_excel("arg_check.xlsx") %>% 
  rename(writing_task = Q21.1, 
         mlengthwords = `Num Words`, 
         respid = ResponseId)

arg_check$Trim <- ifelse(arg_check$mlengthwords < 40 | arg_check$mlengthwords > 330, "Exclude", "Include")

table(arg_check$Trim == "Exclude")

# 12 excluded for being too short or not writing anything
sum(arg_check$mlengthwords < 40)

# 2 excluded for being too long
sum(arg_check$mlengthwords > 330)

# This leaves 400 total arguments
arg_check <- arg_check %>% 
  filter(Trim != "Exclude")

# Check the number of arguments for issue side once we account for exclusions (due to e.g., length, incomprehension, overt offensiveness)
table(arg_check$side)

# Create a new dataframe keeping rows where Excluded is not 1
arg_check_filtered <- arg_check %>% 
  filter(is.na(Excluded) | Excluded != 1)



table(arg_check_filtered$side)

```


## Arguments made before and after a certain date

```{r}

# Remove excluded arguments from the data frame
arg_check <- arg_check %>% 
  dplyr::select(respid, Trim) %>% 
  filter(Trim != "Exclude")

# Join df's so that the sender's file does not include arguments that were excluded
df <- right_join(df, arg_check, by = "respid")


# Convert to date
df$EndDate <- as.Date(df$EndDate)

# Make a df that only keeps arguments made on or before 2021-10-22
dfdate <- df %>% 
  filter(EndDate <= "2021-10-22")

# See the max number of responses for a liberal issue side and the min number 
# of responses for a conservative issue side. 
table(dfdate$side)

rm(dfdate)

```



## Persuasion Change Graph
## Figure A.5.1: Receiver Persuasion, by Sender’s Issue Side (Study 1)
#In line with the graph included in the text, make a persuasion change graph 
#with the x-axis ranging from -10 to 10. 

```{r}
library(ggplot2)
library(gridExtra)

df2 <-df2 %>% 
  mutate(change2 = quarkelt2 - quarkelt1)

# Plot by issue side
df2 <- df2 %>% 
  group_by(side)

# Recode the side variable for graphing
df2$side <- factor(df2$side, levels = c("env_cons", "imm_cons", "trans_cons", 
                             "env_lib", "imm_lib", "trans_lib"))
# Change side labels for title in graphs
df2$side <- recode(df2$side, 
                  "env_cons" = "Conservative Energy",
                  "imm_cons" = "Conservative Immigration", 
                  "trans_cons" = "Conservative Transgender", 
                  "env_lib" = "Liberal Energy", 
                  "imm_lib" = "Liberal Immigration", 
                  "trans_lib" = "Liberal Transgender")

plot1 <- by(df2, df2$side, function(sub){
  ggplot(sub, aes(change2)) +
        geom_histogram(aes(y = (..count..)/sum(..count..)),
                   color="black", fill="gray", bins = 20) +
        ggtitle(sub$side[[1]]) + 
    scale_x_continuous(breaks = seq(-10, 10 , 5), 
                       limits = c(-10.5, 10.5)) + 
    scale_y_continuous(labels = scales::percent, 
                       breaks = seq(0,.8, .2), 
                       limits = c(-0.05, .70)) + 
  theme_bw() + 
  theme(plot.title = element_text(hjust = 0.5, size = 9, face = "bold") , 
          axis.title.x = element_blank(), 
          axis.title.y = element_blank())
  })

plot1 <- grid.arrange(arrangeGrob(grobs = plot1, ncol = 3, 
                         bottom = textGrob("Persuasion",
                                           gp = gpar(fontsize = 10,
                                                     fontface = "bold")),
                         left = textGrob("Percent",
                                         rot = 90,
                                         gp = gpar(fontsize = 10, 
                                                   fontface = "bold")),
                         ))

```

```{r}
df2$change2_category <- cut(df2$change2, 
                            breaks = c(-Inf, -1, 0, 10), 
                            labels = c("-4 to -1", "0", "1 to 10"),
                            right = TRUE)

# Check the distribution using a table
table(df2$change2_category)


```



#How much attitude change do we observe?

```{r}
#Below is code to replicate following sentence in the main text:
#In Study 1, pooling across all issues, 64% of opinions were unchanged, 25% moved in the Sender’s intended direction, and 11% moved away from the Sender. 

summary(df2$movement)
#  -1    0    1 NA's 
# 310 1782  689  270 

#No Change (0.6407767)
1782/(310+1782+689)

#Persuasion (0.2477526)
689/(310+1782+689)

#Backlash (0.1114707)
310/(310+1782+689)


table(df2$movement, df2$side)

```

#Calculating average persuasion for each argument (Discussion footnote)
```{r}
#Below code can be used to replicate calculations pertaining to Study 1 for footnote 20 in main text:
#Rather than summarizing across message presentations, we can also calculate an average persuasion score for each argument written by our Senders. 
# Following this approach, in Study 1, we find that, on average, 15% of messages generate backfire, 19% generate stasis, and 66% generate persuasion. 

df2 <-df2 %>% 
  mutate(change2 = quarkelt2 - quarkelt1)

av_pers <- df2 %>% 
  group_by(respid) %>% 
  summarise_at(vars(change2),
               list(mean = mean), na.rm = T) %>% 
  as.list(.)


length(av_pers$mean[!is.na(av_pers$mean)]) #379

length(which(av_pers$mean == 0)) # 73 (0.1926121) (73/379)
length(which(av_pers$mean < 0)) # 56 (0.1477573) (56/379)
length(which(av_pers$mean > 0)) # 250 (0.6596306) (250/379)
```


# Table 3: Persuasion by Issue Side (Study 1)
# Table A.5.1 (Attitude Change in Standard Deviations, by Issue Side (Study 1)
## Calculate the mean change, standard error, and standard deviation of the outcome

```{r}
library(dplyr)

df_summary <- df2 %>% 
  group_by(side) %>% 
  summarise(
    mean_change = mean(change2, na.rm = TRUE),
    se_change = sd(change2, na.rm = TRUE) / sqrt(n()),
    sd_outcome = sd(change2, na.rm = TRUE)
  )

# Calculate the attitude change in standard deviations of the outcome
df_summary <- df_summary %>%
  mutate(
    change_in_sd = mean_change / sd_outcome
  )

# Print the results
df_summary

mean_change_overall <- mean(df2$change2, na.rm = TRUE)
sd_outcome_overall <- sd(df2$change2, na.rm = TRUE)

```

# Table 3: Persuasion by Issue Side (Study 1)
## Testing for Significance of Persuasion Differences by Issue Side (p-values)

```{r}
# Make a change2 variable that indicates any persuasion that takes place
df2 <-df2 %>% 
  mutate(change2 = quarkelt2 - quarkelt1)

# Make a function to calculate the standard error
se <- function(x, ...) sqrt(var(x, ...)/length(x))

# Calculate the standard error and mean by issue side
df2 %>% 
  group_by(side) %>% 
  summarise_at(vars(change2),
               list(mean = mean, se = se), na.rm = T) %>% 
  as.list(.)

# Environment
df_env <- df2 %>% 
  filter(side %in% c("Conservative Energy", "Liberal Energy")) %>% 
  group_by(side) 


summary(lm(change2 ~ side, data = df_env))

rm(df_env)

# Immigration 
df_imm <- df2 %>% 
  filter(side %in% c("Conservative Immigration", "Liberal Immigration")) %>% 
  group_by(side) 

summary(lm(change2 ~ side, data = df_imm))


rm(df_imm)

# Transgender Rights 
df_trans <- df2 %>% 
  filter(side %in% c("Conservative Transgender", "Liberal Transgender")) %>% 
  group_by(side) 

summary(lm(change2 ~ side, data = df_trans))

rm(df_trans)

# For later use (see median section)
dfmed <- df2 %>% 
  filter(mlengthwords > median(df2$mlengthwords))

```

```{r}
# Calculate the attitude change in standard deviations of the outcome
# Footnote 5 "...the mean attitude change was approximately 0.3 standard deviations of the outcome variable."

change_in_sd_overall <- mean_change_overall / sd_outcome_overall
change_in_sd_overall
#0.2905077

```


# Table 4: Variance Explained by Various Factors (Study 1)
## R-Squared for sender, receiver and issue side fixed effects

```{r}
# Sender fixed-effects
mod1 <- lm(quarkelt2 ~ respid, data = df2)
summary(mod1)$r.squared
 
# Receiver Fixed effects
mod2 <- lm(quarkelt2 ~ respondent, data = df2)
summary(mod2)$r.squared

# Issue-side Fixed Effects 
mod3 <- lm(quarkelt2 ~ side, data = df2)
summary(mod3)$r.squared
```

### Range Standardize Variables
```{r}
range01 <- function(x, ...){(x - min(x, ...)) / (max(x, ...) - min(x, ...))}

# Note that political knowledge and interest already vary between 0 and 1.
df2$affpol <- range01(df2$affpol, na.rm = T)
df2$att_strength <- range01(df2$att_strength, na.rm = T)
df2$persp_tak <- range01(df2$persp_tak, na.rm = T)
df2$nfc <- range01(df2$nfc, na.rm = T)
df2$self_est <- range01(df2$self_est, na.rm = T)
df2$mlengthwords <- range01(df2$mlengthwords, na.rm = T)
df2$mlengthchar <- range01(df2$mlengthchar, na.rm = T)
df2$time <- range01(df2$time, na.rm = T)
df2$age <- range01(df2$age, na.rm = T)
df2$income <- range01(df2$income, na.rm = T)
```


## Main Analysis: Sender Characteristics

```{r}
df2$movement_3 <- df2$movement
df2$movement_3 <- as.ordered(df2$movement_3)
```

### Main text analyses
## Party ID Intensity
```{r}
### Make a new variable called partyid_cat where a 1 indicates a pure independent
### (4 in partyid_7), 2 indicates a leaner (5 and 3 in partyid_7), 3 indicates 
### a not strong partisan (6 and 2 in partyid_7) and 4 indicates a strong partisan
### (7 and 1 in partyid_7)

df2$partyid_cat <- NA

df2$partyid_cat[df2$partyid_7 == 4] <- 1
df2$partyid_cat[df2$partyid_7 == 3 | df2$partyid_7 == 5] <- 2
df2$partyid_cat[df2$partyid_7 == 2 | df2$partyid_7 == 6] <- 3
df2$partyid_cat[df2$partyid_7 == 1 | df2$partyid_7 == 7] <- 4

df2$partyid_cat <- as.factor(df2$partyid_cat)
```


#Below is code for:
# Table 5: Hypothesis tests (Study 1)
# Table A.6.1: Hypothesis tests, Study 1 (H1-H6)
# Table A.6.2: Hypothesis tests, Study 1 (H7-H14)

# As noted in the main text (see, e.g., the note under Table 5), the p-values in Table 2 reflect one-tailed tests
# given that our hypotheses are pre-registered and directional. 
# Accordingly, the one-tailed test p-values are calculated by dividing the p-values generated by the lmer function by 2.

#H1: Need for cognition is associated with greater persuasion
```{r}
fit_nfc <- lmer(quarkelt2 ~ quarkelt1 + nfc + issue +
                           (1|respid)+ (1|respondent), data = df2)
cooks_h3 <- as.data.frame(cooks.distance(fit_nfc))

df_estimation_3 <- df2[as.numeric(rownames(cooks_h3)), ]


fit_nfc_est <- lmer(quarkelt2 ~ quarkelt1 + nfc + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_3)
cooks_h3 <- as.data.frame(cooks.distance(fit_nfc_est))

mean(cooks_h3$`cooks.distance(fit_nfc_est)`) + 2*sd(cooks_h3$`cooks.distance(fit_nfc_est)`)
#0.1860226


df_reduced_nfc <- df_estimation_3[cooks_h3$`cooks.distance(fit_nfc_est)` < 0.1860226,]

fit_nfc_cooks <- lmer(quarkelt2 ~ quarkelt1 + nfc + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_nfc)

summary(fit_nfc_cooks)

#nfc            0.13479    0.09774  290.36714   1.379  0.16894    

#p=0.08447 (0.16894/2)

initial_count <- nrow(df_estimation_3)
reduced_count <- nrow(df_reduced_nfc)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage
#2.876663
```


# H2: Perspective taking ability is associated with greater persuasion

```{r}
library(lmerTest)

fit_persptak <- lmer(quarkelt2 ~ quarkelt1 + persp_tak + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_persptak)


cooks_h8 <- as.data.frame(cooks.distance(fit_persptak))

df_estimation_8 <- df2[as.numeric(rownames(cooks_h8)), ]


fit_persptak_est <- lmer(quarkelt2 ~ quarkelt1 + persp_tak + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_8)
summary(fit_persptak_est)


cooks_h8 <- as.data.frame(cooks.distance(fit_persptak_est))


mean(cooks_h8$`cooks.distance(fit_persptak_est)`) + 2*sd(cooks_h8$`cooks.distance(fit_persptak_est)`)
#0.1862881

df_reduced_persptak <- df_estimation_8[cooks_h8$`cooks.distance(fit_persptak_est)` < 0.1862881,]

fit_persptak_cooks <- lmer(quarkelt2 ~ quarkelt1 + persp_tak + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_persptak)

summary(fit_persptak_cooks)


#persp_tak      0.16957    0.10821  252.34734   1.567   0.1184    

#p=0.0592 (0.1184/2)

#2781-2701
#80/2781
#0.02876663

initial_count <- nrow(df_estimation_8)
reduced_count <- nrow(df_reduced_persptak)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.876663

```

# H3: Senders who use personal appeals are more persuasive

```{r}
fit_personal_rev <- lmer(quarkelt2 ~ quarkelt1 + personal_rev + issue +
                           (1|respid)+ (1|respondent), data = df2) 
summary(fit_personal_rev)

cooks_h9 <- as.data.frame(cooks.distance(fit_personal_rev))

df_estimation_9 <- df2[as.numeric(rownames(cooks_h9)), ]


fit_personal_rev_est <- lmer(quarkelt2 ~ quarkelt1 + personal_rev + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_9)
summary(fit_personal_rev_est)


cooks_h9 <- as.data.frame(cooks.distance(fit_personal_rev_est))


mean(cooks_h9$`cooks.distance(fit_personal_rev_est)`) + 2*sd(cooks_h9$`cooks.distance(fit_personal_rev_est)`)
#0.1865181

df_reduced_personal_rev <- df_estimation_9[cooks_h9$`cooks.distance(fit_personal_rev_est)` < 0.1865181,]


fit_personal_rev_cooks <- lmer(quarkelt2 ~ quarkelt1 + personal_rev + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_personal_rev)

summary(fit_personal_rev_cooks)


#personal_rev1    0.26314    0.08308  333.40805   3.167  0.00168 ** 

#p=0.00084 (0.00168/2)


initial_count <- nrow(df_estimation_9)
reduced_count <- nrow(df_reduced_personal_rev)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.840705
```



# H4: Senders who highlight common ground are more persuasive

```{r}
fit_common_ground <- lmer(quarkelt2 ~ quarkelt1 + common_ground + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_common_ground)

cooks_h10 <- as.data.frame(cooks.distance(fit_common_ground))

df_estimation_10 <- df2[as.numeric(rownames(cooks_h10)), ]


fit_cg_est <- lmer(quarkelt2 ~ quarkelt1 + common_ground + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_10)
summary(fit_cg_est)

cooks_h10 <- as.data.frame(cooks.distance(fit_cg_est))


mean(cooks_h10$`cooks.distance(fit_cg_est)`) + 2*sd(cooks_h10$`cooks.distance(fit_cg_est)`)
#0.1850018

df_reduced_cg <- df_estimation_10[cooks_h10$`cooks.distance(fit_cg_est)` < 0.1850018,]


fit_cg_cooks <- lmer(quarkelt2 ~ quarkelt1 + common_ground + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_cg)

summary(fit_cg_cooks)

#common_ground1    0.14057    0.05300  280.91812   2.652  0.00845 ** 

#p=0.004225 (0.00845/2)


initial_count <- nrow(df_estimation_10)
reduced_count <- nrow(df_reduced_cg)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage
#2.899601
```


# H5: Long messages are more persuasive

```{r}
fit_length <- lmer(quarkelt2 ~ quarkelt1 + mlengthwords + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_length)

cooks_h11 <- as.data.frame(cooks.distance(fit_length))

df_estimation_11 <- df2[as.numeric(rownames(cooks_h11)), ]


fit_length_est <- lmer(quarkelt2 ~ quarkelt1 + mlengthwords + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_11)
summary(fit_length_est)

cooks_h11 <- as.data.frame(cooks.distance(fit_length_est))


mean(cooks_h11$`cooks.distance(fit_length_est)`) + 2*sd(cooks_h11$`cooks.distance(fit_length_est)`)
#0.1769251

df_reduced_length <- df_estimation_11[cooks_h11$`cooks.distance(fit_length_est)` < 0.1769251,]


fit_length_cooks <- lmer(quarkelt2 ~ quarkelt1 + mlengthwords + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_length)

summary(fit_length_cooks)


#mlengthwords    0.54803    0.11559  316.76006   4.741 3.22e-06 ***

initial_count <- nrow(df_estimation_11)
reduced_count <- nrow(df_reduced_length)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage
#2.804746
```



# H6: Messages that took more time to write are more persuasive

```{r}

# Time (in seconds)
fit_time <- lmer(quarkelt2 ~ quarkelt1 + time + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_time)

cooks_h12 <- as.data.frame(cooks.distance(fit_time))

df_estimation_12 <- df2[as.numeric(rownames(cooks_h12)), ]


fit_time_est <- lmer(quarkelt2 ~ quarkelt1 + time + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_12)
summary(fit_time_est)

cooks_h12 <- as.data.frame(cooks.distance(fit_time_est))


mean(cooks_h12$`cooks.distance(fit_time_est)`) + 2*sd(cooks_h12$`cooks.distance(fit_time_est)`)
#0.1886486

df_reduced_time <- df_estimation_12[cooks_h12$`cooks.distance(fit_time_est)` < 0.1886486,]


fit_time_cooks <- lmer(quarkelt2 ~ quarkelt1 + time + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_time)

summary(fit_time_cooks)

#time           0.36953    0.14859  290.22145   2.487 0.013446 *  
#p=0.006723 (0.013446/2)


initial_count <- nrow(df_estimation_12)
reduced_count <- nrow(df_reduced_time)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.876663
```

```{r}
# Length AND time
# Used to replicate calculations in Footnote 19 ("When we enter both...")
fit_lengthtime <-  lmer(quarkelt2 ~ quarkelt1 + issue + mlengthwords + time +
                          (1|respid) + (1|respondent), data = df2)
summary(fit_lengthtime)

cooks_lengthtime <- as.data.frame(cooks.distance(fit_lengthtime))

df_estimation_lt <- df2[as.numeric(rownames(cooks_lengthtime)), ]


fit_lengthtime_est <- lmer(quarkelt2 ~ quarkelt1 + issue + mlengthwords + time +
                          (1|respid) + (1|respondent), data = df_estimation_lt)

cooks_lengthtime <- as.data.frame(cooks.distance(fit_lengthtime_est))


mean(cooks_lengthtime$`cooks.distance(fit_lengthtime_est)`) + 2*sd(cooks_lengthtime$`cooks.distance(fit_lengthtime_est)`)
#0.1474792

df_reduced_lt <- df_estimation_lt[cooks_lengthtime$`cooks.distance(fit_lengthtime_est)` < 0.1474792,]


summary(lmer(quarkelt2 ~ quarkelt1 + issue + mlengthwords + time +
                          (1|respid) + (1|respondent), data = df_reduced_lt))


#mlengthwords  5.509e-01  1.357e-01  2.797e+02   4.058 6.43e-05 ***
#time         -8.375e-03  1.715e-01  2.520e+02  -0.049   0.9611    

# p= 0.48055 (0.9611/2)
```


#H7: Independent leaners more persuasive arguments than pure independents
```{r}
# Leaners better at persuading relative to pure independents

df_partyintensity_1_2 <- subset(df2, partyid_cat == 1 | partyid_cat == 2)


fit_partyintensity_lean <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data =df_partyintensity_1_2)

summary(fit_partyintensity_lean)
#partyid_cat2   0.08678    0.22310  83.81610   0.389   0.6983    



cooks_h6 <- as.data.frame(cooks.distance(fit_partyintensity_lean))

df_estimation_6 <- df_partyintensity_1_2[as.numeric(rownames(cooks_h6)), ]


fit_partyint_lean_est <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data = df_estimation_6)

summary(fit_partyint_lean_est)

cooks_h6 <- as.data.frame(cooks.distance(fit_partyint_lean_est))

mean(cooks_h6$`cooks.distance(fit_partyint_lean_est)`) + 2*sd(cooks_h6$`cooks.distance(fit_partyint_lean_est)`)


df_reduced_partyint_lean <- df_estimation_6[cooks_h6$`cooks.distance(fit_partyint_lean_est)` < 0.08179532,]

fit_partyint_lean_cooks <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_partyint_lean)

summary(fit_partyint_lean_cooks)

#partyid_cat2   0.09468    0.13521  72.83098   0.700    0.486    

#p=0.243 (0.486/2)


initial_count <- nrow(df_estimation_6)
reduced_count <- nrow(df_reduced_partyint_lean)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.821317
```

#H8: Strong party identifiers less persuasive than weak dentifiers
```{r}

library(lmerTest)

fit_partyintensity_sw <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data =df2[(df2$partyid_cat==3 | df2$partyid_cat==4),])

summary(fit_partyintensity_sw)

#Create New Dataframe that includes only rows where df2$partyid_cat is 3 or 4

df_partyintensity_3_4 <- subset(df2, partyid_cat == 3 | partyid_cat == 4)

fit_partyintensity_sw <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data = df_partyintensity_3_4)

summary(fit_partyintensity_sw)


cooks_h5 <- as.data.frame(cooks.distance(fit_partyintensity_sw))

df_estimation_5 <- df_partyintensity_3_4[as.numeric(rownames(cooks_h5)), ]


fit_partyint_est <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data = df_estimation_5)

summary(fit_partyint_est)

cooks_h5 <- as.data.frame(cooks.distance(fit_partyint_est))

mean(cooks_h5$`cooks.distance(fit_partyint_est)`) + 2*sd(cooks_h5$`cooks.distance(fit_partyint_est)`)


df_reduced_partyint <- df_estimation_5[cooks_h5$`cooks.distance(fit_partyint_est)` < 0.2039463,]

fit_partyint_cooks <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_partyint)

summary(fit_partyint_cooks)

#partyid_cat4 -1.258e-01  5.437e-02  2.232e+02  -2.314   0.0216 *  

#p=0.011 (0.0216/2)

initial_count <- nrow(df_estimation_5)
reduced_count <- nrow(df_reduced_partyint)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.89314
```



#H9: Affective polarization is associated with lower persuasiveness

```{r}
library(lme4)
### Affective Polarization ###

# Linear Analysis: Affective Polarization 
fit_affpol <- lmer(quarkelt2 ~ quarkelt1 + affpol + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_affpol)

cooks_h7 <- as.data.frame(cooks.distance(fit_affpol))

df_estimation_7 <- df2[as.numeric(rownames(cooks_h7)), ]


fit_affpol_est <- lmer(quarkelt2 ~ quarkelt1 + affpol + 
                                  issue + (1|respid) + (1|respondent), 
                                data = df_estimation_7)

summary(fit_affpol_est)

cooks_h7 <- as.data.frame(cooks.distance(fit_affpol_est))

mean(cooks_h7$`cooks.distance(fit_affpol_est)`) + 2*sd(cooks_h7$`cooks.distance(fit_affpol_est)`)
#0.1819534

df_reduced_affpol <- df_estimation_7[cooks_h7$`cooks.distance(fit_affpol_est)` < 0.1819534,]

fit_affpol_cooks <- lmer(quarkelt2 ~ quarkelt1 + affpol + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_affpol)

summary(fit_affpol_cooks)

#affpol        -0.14625    0.07438  276.46408  -1.966   0.0503 .  
#p=0.02515 (0.0503/2)


initial_count <- nrow(df_estimation_7)
reduced_count <- nrow(df_reduced_affpol)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.883922
```


#H10: Interest in politics is associated with greater persuasiveness

```{r}

fit_polintr2 <-  lmer(quarkelt2 ~ quarkelt1 + pol_intr_full + issue +
                           (1|respid)+ (1|respondent), data = df2)

cooks_h2 <- as.data.frame(cooks.distance(fit_polintr2))

df_estimation_2 <- df2[as.numeric(rownames(cooks_h2)), ]


fit_polintr_est <- lmer(quarkelt2 ~ quarkelt1 + pol_intr_full + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_2)

cooks_h2 <- as.data.frame(cooks.distance(fit_polintr_est))

mean(cooks_h2$`cooks.distance(fit_polintr_est)`) + 2*sd(cooks_h2$`cooks.distance(fit_polintr_est)`)
#0.1874566


df_reduced_pi <- df_estimation_2[cooks_h2$`cooks.distance(fit_polintr_est)` < 0.1874566,]

fit_pi_cooks <- lmer(quarkelt2 ~ quarkelt1 + pol_intr_full + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_pi)

summary(fit_pi_cooks)

#pol_intr_full    0.05706    0.09473  280.00938   0.602  0.54743    


#p=0.274 (0.54743/2)

#Data Loss (2.840705)
initial_count <- nrow(df_estimation_2)
reduced_count <- nrow(df_reduced_pi)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100

#2.840705
```

# H11: Political knowledge is associated with greater persuasiveness
### Political Knowledge 
```{r}

fit_polknow <-  lmer(quarkelt2 ~ quarkelt1 + pol_know_avg + issue +
                           (1|respid)+ (1|respondent), data = df2)

cooks_h1 <- as.data.frame(cooks.distance(fit_polknow))

df_estimation_1 <- df2[as.numeric(rownames(cooks_h1)), ]


fit_polknow_est <- lmer(quarkelt2 ~ quarkelt1 + pol_know_avg + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_1)

cooks_h1 <- as.data.frame(cooks.distance(fit_polknow_est))

mean(cooks_h1$`cooks.distance(fit_polknow_est)`) + 2*sd(cooks_h1$`cooks.distance(fit_polknow_est)`)
#0.1850928

df_reduced_pk <- df_estimation_1[cooks_h1$`cooks.distance(fit_polknow_est)` < 0.1850928,]

fit_pk_cooks <- lmer(quarkelt2 ~ quarkelt1 + pol_know_avg + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_pk)

summary(fit_pk_cooks)
#pol_know_avg    0.06767    0.07411  271.99304   0.913   0.3620    

#p=0.181 (0.3620/2)

#Data Loss (#2.888483)
initial_count <- nrow(df_estimation_1)
reduced_count <- nrow(df_reduced_pk)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage
#2.888483

```



#H12: Senders who mention specific facts are more persuasive

```{r}
fit_specific_fact <- lmer(quarkelt2 ~ quarkelt1 + specific_fact + issue +
                           (1|respid)+ (1|respondent), data = df2) 
summary(fit_specific_fact)

cooks_h4 <- as.data.frame(cooks.distance(fit_specific_fact))

df_estimation_4 <- df2[as.numeric(rownames(cooks_h4)), ]


fit_fact_est <- lmer(quarkelt2 ~ quarkelt1 + specific_fact + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_4)
summary(fit_fact_est)

cooks_h4 <- as.data.frame(cooks.distance(fit_fact_est))

mean(cooks_h4$`cooks.distance(fit_fact_est)`) + 2*sd(cooks_h4$`cooks.distance(fit_fact_est)`)
#0.1843912


df_reduced_fact <- df_estimation_4[cooks_h4$`cooks.distance(fit_fact_est)` < 0.1843912,]

fit_fact_cooks <- lmer(quarkelt2 ~ quarkelt1 + specific_fact + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_fact)
summary(fit_fact_cooks)

#specific_fact1  1.592e-01  8.626e-02  2.650e+02   1.846    0.066 .  

#p=0.033 (0.066/2)

initial_count <- nrow(df_estimation_4)
reduced_count <- nrow(df_reduced_fact)

data_loss_percentage <- ((initial_count - reduced_count) / initial_count) * 100
data_loss_percentage

#2.840705
```



# H13: Senders with self-esteem more persuasive

```{r}
library(lmerTest)
### Self Esteem ###

fit_selfest <- lmer(quarkelt2 ~ quarkelt1 + self_est + issue +
                           (1|respid)+ (1|respondent), data = df2)


cooks_selfest1 <- as.data.frame(cooks.distance(fit_selfest))

df_estimation_selfest1 <- df2[as.numeric(rownames(cooks_selfest1)), ]


fit_selfest1_est <- lmer(quarkelt2 ~ quarkelt1 + self_est + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_selfest1)
summary(fit_selfest1_est)


cooks_selfest1 <- as.data.frame(cooks.distance(fit_selfest1_est))


mean(cooks_selfest1$`cooks.distance(fit_selfest1_est)`) + 2*sd(cooks_selfest1$`cooks.distance(fit_selfest1_est)`)
#0.1864968

df_reduced_selfest1 <- df_estimation_selfest1[cooks_selfest1$`cooks.distance(fit_selfest1_est)` < 0.1864968,]

fit_selfest_1_cdr <- lmer(quarkelt2 ~ quarkelt1 + self_est + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_selfest1)

summary(fit_selfest_1_cdr)

#self_est       0.04773    0.09389  305.45500   0.508  0.61155    

#p=0.305775 (0.61155/2)



```



# H14: Issue Attitude Extremity
```{r}
### Attitude Strength ###
fit_attstrength <-  lmer(quarkelt2 ~ quarkelt1 + att_strength + issue +
                           (1|respid)+ (1|respondent), data = df2)

summary(fit_attstrength)

cooks_attstrength <- as.data.frame(cooks.distance(fit_attstrength))

df_estimation_attstrength <- df2[as.numeric(rownames(cooks_attstrength)), ]


fit_attstrength_est <- lmer(quarkelt2 ~ quarkelt1 + att_strength + issue +
                           (1|respid)+ (1|respondent), data = df_estimation_attstrength)
summary(fit_attstrength_est)


cooks_attstrength <- as.data.frame(cooks.distance(fit_attstrength_est))


mean(cooks_attstrength$`cooks.distance(fit_attstrength_est)`) + 2*sd(cooks_attstrength$`cooks.distance(fit_attstrength_est)`)
#0.1866542

df_reduced_attstrength <- df_estimation_attstrength[cooks_attstrength$`cooks.distance(fit_attstrength_est)` < 0.1866542,]

fit_attstrength_cooks <- lmer(quarkelt2 ~ quarkelt1 + att_strength + issue +
                           (1|respid)+ (1|respondent), data = df_reduced_attstrength)
summary(fit_attstrength_cooks)

#att_strength   -0.03248    0.06662  259.97769  -0.488   0.6263    

#p = 0.31315 (0.6263/2)
```


# Table A.6.1: Hypothesis Tests, Study 1 (H1-H6)
```{r}

library("texreg")

texreg(l = list(fit_nfc_cooks, fit_persptak_cooks, fit_personal_rev_cooks, fit_cg_cooks, fit_length_cooks, fit_time_cooks),stars = c(0.2, 0.1))

```

# Table A.6.2: Hypothesis Tests, Study 1 (H7-H14)
```{r}
library("texreg")

texreg(l = list(fit_partyint_cooks, fit_partyint_lean_cooks, fit_affpol_cooks, fit_pi_cooks, fit_pk_cooks, fit_fact_cooks, fit_selfest_1_cdr, fit_attstrength_cooks),stars = c(0.2, 0.1))
```


##Main Text Section: DO PERSUASIVE PEOPLE KNOW THEY CAN PERSUADE?
```{r}
# The following code replicates the calculations for Study 1 presented in the 
# "Do persuasive people know that they are persuasive?" section of the main text.

# Expected persuasion (Continuous)
df2$task_persuade <- range01(df2$task_persuade, na.rm = T)

fit_task_persuade <-  lmer(quarkelt2 ~ quarkelt1 + task_persuade + issue + 
                             (1|respid) + (1|respondent), data = df2)
summary(fit_task_persuade)

df2 <- within(df2, task_expect <- relevel(task_expect, ref = 2))

fit_expect <-  lmer(quarkelt2 ~ quarkelt1 + task_expect + issue + 
                      (1|respid) + (1|respondent), data = df2)

summary(fit_expect)

```

#Table A.7.1: Self-knowledge About Persuasion (Study 1) 
```{r}

library("texreg")

texreg(l = list(fit_task_persuade, fit_expect),stars = c(0.001, 0.01, 0.05))

```


# SI SECTION 10: EDUCATION AND PERSUASIVENESS

# Table A.10.1: Relationship Between Sender Education and Persuasiveness (Study 1)

```{r}

df2$edu <- as.numeric(df2$edu)

range01 <- function(x, ...){(x - min(x, ...)) / (max(x, ...) - min(x, ...))}

df2$edu <- range01(df2$edu, na.rm = T)

edu_senders_1 <- lmer(quarkelt2 ~ quarkelt1 + issue + edu +
                           (1|respid)+ (1|respondent), data = df2)
summary(edu_senders_1)

```


# SI SECTION 8: RESULTS FROM PRE-REGISTERED CHECKS

# Below code can be used to replicate figures in Table A.8.1: Hypothesis Tests Withot Cook's D-Based Exclusions (Study 1)

#H1: Need for cognition is associated with greater persuasion

```{r}
fit_nfc <- lmer(quarkelt2 ~ quarkelt1 + nfc + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_nfc)
```

```{r}

nfc_bnp <- ordinal::clmm(movement_3 ~ nfc + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(nfc_bnp)

```

# H2: Perspective taking ability is associated with greater persuasion

```{r}
fit_persptak <- lmer(quarkelt2 ~ quarkelt1 + persp_tak + issue +
                           (1|respid)+ (1|respondent), data = df2)

summary(fit_persptak)
```



```{r}

persp_tak_bnp <- ordinal::clmm(movement_3 ~ persp_tak + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(persp_tak_bnp)

```

# H3: Senders who use personal appeals are more persuasive

```{r}
fit_personal_rev <- lmer(quarkelt2 ~ quarkelt1 + personal_rev + issue +
                           (1|respid)+ (1|respondent), data = df2) 
summary(fit_personal_rev)

```


```{r}

fit_personal_rev_bnp <- ordinal::clmm(movement_3 ~ personal_rev + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit') 
summary(fit_personal_rev_bnp)

```

# H4: Senders who highlight common ground are more persuasive

```{r}
fit_common_ground <- lmer(quarkelt2 ~ quarkelt1 + common_ground + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_common_ground)
```

```{r}
fit_common_ground_bnp <- ordinal::clmm(movement_3 ~ common_ground + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(fit_common_ground_bnp)
```

# H5: Long messages are more persuasive

```{r}
# Message Length (in words)
fit_length <- lmer(quarkelt2 ~ quarkelt1 + mlengthwords + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_length)

```

```{r}
# Message Length (in words)
fit_length_bnp <- ordinal::clmm(movement_3 ~ mlengthwords + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')

summary(fit_length_bnp)


```

# H6: Messages that took more time to write are more persuasive

```{r}
# Time (in seconds)
fit_time <- lmer(quarkelt2 ~ quarkelt1 + time + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_time)

```

```{r}
# Time (in seconds)
fit_time_bnp <- ordinal::clmm(movement_3 ~ time + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(fit_time_bnp)
```

#H7: Independent leaners more persuasive arguments than pure independents
```{r}
fit_partyintensity_lean <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data =df2[(df2$partyid_cat==1 | df2$partyid_cat==2),])

summary(fit_partyintensity_lean)
```


```{r}
partyintensity_lean_bnp <- ordinal::clmm(movement_3 ~ partyid_cat + issue + (1|respid) + (1|respondent),
                              data =df2[(df2$partyid_cat==1 | df2$partyid_cat==2),], link='logit')
summary(partyintensity_lean_bnp)
```



#H8: Strong party identifiers less persuasive than weak dentifiers
```{r}
library(lmerTest)
fit_partyintensity_sw <- lmer(quarkelt2 ~ quarkelt1 + partyid_cat + 
                                  issue + (1|respid) + (1|respondent), 
                                data =df2[(df2$partyid_cat==3 | df2$partyid_cat==4),])

summary(fit_partyintensity_sw)
```

```{r}
partyintensity_sw_bnp <- ordinal::clmm(movement_3 ~ partyid_cat + issue + (1|respid) + (1|respondent),
                              data =df2[(df2$partyid_cat==3 | df2$partyid_cat==4),], link='logit')
summary(partyintensity_sw_bnp)
```


#H9: Affective polarization is associated with lower persuasiveness

```{r}
library(lme4)

fit_affpol <- lmer(quarkelt2 ~ quarkelt1 + affpol + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_affpol)

# Cubic Analysis: Affective Polarization 
fit_affpol2 <- lmer(quarkelt2 ~ quarkelt1 + affpol + I(affpol^2) + I(affpol^3) + issue +
                           (1|respid)+ (1|respondent), data = df2)

summary(fit_affpol2)

# Compare model fit
anova(fit_affpol2, fit_affpol)

```


```{r}
affpol_bnp_1 <- ordinal::clmm(movement_3 ~ affpol + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(affpol_bnp_1)


affpol_bnp_2 <- ordinal::clmm(movement_3 ~ affpol + I(affpol^2) + I(affpol^3) + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(affpol_bnp_2)

#Comparing model fit
anova(affpol_bnp_2, affpol_bnp_1)

```


# H10: Interest in politics is associated with greater persuasiveness

```{r}


fit_polintr2 <-  lmer(quarkelt2 ~ quarkelt1 + pol_intr_full + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_polintr2)
```

```{r}

pol_intr_bnp_2 <- ordinal::clmm(movement_3 ~ pol_intr_full + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(pol_intr_bnp_2)

```


# H11: Political knowledge is associated with greater persuasiveness
```{r}
fit_polknow <-  lmer(quarkelt2 ~ quarkelt1 + pol_know_avg + issue +
                           (1|respid)+ (1|respondent), data = df2)
summary(fit_polknow)
```


```{r}

pol_know_bnp <- ordinal::clmm(movement_3 ~ pol_know_avg + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(pol_know_bnp)

```


#H12: Senders who mention specific facts are more persuasive

```{r}
library(lmerTest)
fit_specific_fact <- lmer(quarkelt2 ~ quarkelt1 + specific_fact + issue +
                           (1|respid)+ (1|respondent), data = df2) 
summary(fit_specific_fact)
```

```{r}

fit_specific_fact_bnp <- ordinal::clmm(movement_3 ~ specific_fact + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit') 
summary(fit_specific_fact_bnp)
```



#H13: Self-Esteem
```{r}
### Self-Esteem 
fit_selfest <- lmer(quarkelt2 ~ quarkelt1 + self_est + issue +
                           (1|respid)+ (1|respondent), data = df2)

summary(fit_selfest)

```

```{r}
fit_selfesteem_bnp <- ordinal::clmm(movement_3 ~ self_est + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(fit_selfesteem_bnp)

```
#H14: Attitude Extremity

```{r}
fit_attstrength <-  lmer(quarkelt2 ~ quarkelt1 + att_strength + issue +
                           (1|respid)+ (1|respondent), data = df2)

summary(fit_attstrength)

```

```{r}
fit_attstrength_bnp <- ordinal::clmm(movement_3 ~ att_strength + issue + (1|respid) + (1|respondent),
                              data = df2, link='logit')
summary(fit_attstrength_bnp)

```


